//继承 super 关键字
class Person {
    //公共的属性
    public String name;
    public int age;
    public void happy() {
        System.out.println(this.name+"很开心");
    }
    public Person(String name) {
        System.out.println("父类："+name);
    }
}
class Dog extends Person {
    public void eat() {
        System.out.println(age+"岁的"+name+"正在吃骨头...");
    }
    public void call() {
        System.out.println(age+"岁的"+name+"正在汪汪叫...");
    }
    public Dog() {
        super("阿福");
    }
}
class Cat extends Person{
    public void eat() {
        System.out.println(age+"岁的"+name+"正在吃小鱼");
    }
    public void call() {
        System.out.println(age+"岁的"+name+"正在喵喵叫");
    }
    public Cat() {
        super("小咪咪");
    }
}
public class Inherit {
    public static void main(String[] args) {
    Dog dog = new Dog();
    Cat cat = new Cat();
    dog.name = "旺财";
    dog.age  = 3;
    cat.name = "咪咪";
    cat.age = 2;
    dog.eat();
    dog.call();
    cat.eat();
    cat.call();
    dog.happy();
    cat.happy();
    }
}
